﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using CRMBiz;
using CRMWeb.Utilities.Context;
using Newtonsoft.Json;
namespace CRMWeb.WebServices
{
    /// <summary>
    /// Summary description for SelectAppAndContacts
    /// </summary>
    public class SelectAppAndContacts : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            try
            {
                var input_app_id = string.IsNullOrEmpty(context.Request["app_id"]) ? 0 : int.Parse(context.Request["app_id"]);
                var input_con_id = string.IsNullOrEmpty(context.Request["ContactID"]) ? 0 : int.Parse(context.Request["ContactID"]);
                string strjson = JsonConvert.SerializeObject(EmailTemplateHandler.BindEmail(input_app_id, input_con_id));
                context.Response.Write(strjson);
            }
            catch (Exception ex)
            {
                ErrorHandler.saveErrorLog(ex, CMSContext.CurrentUser.MemberName);
            }
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}